//
//  BonusCell.m
//  DaleTou
//
//  Created by anyfish010 on 2018/5/28.
//  Copyright © 2018年 geren. All rights reserved.
//

#import "BonusCell.h"
#import "XGConfig.h"

@implementation BonusCell{
    NSMutableArray *mArrTop;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    CGFloat padingX = 15;
    CGFloat padingY = padingX;
    CGFloat width = (ScreenWidth - padingX * 8 - 18 * 2)/7;
    CGFloat height = width;
    
    if(self.numberView){
        mArrTop = [NSMutableArray array];
        self.btnarray = [NSMutableArray array];
//        NSArray *arrTitles = @[@"08",@"22",@"25",@"27",@"30",@"05",@"07"];
        for (int i = 0; i < 7; i ++) {
            UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(padingX + (padingX + width) * (i % 7), padingY + (padingY + height) * (i/7), width, height)];
            [mArrTop addObject:btn];
            btn.layer.cornerRadius = width/2;
            btn.layer.masksToBounds = YES;
            btn.tag = 1000 +i;
//            [btn setTitle:arrTitles[i] forState:UIControlStateNormal];
            if(i < 5){
                [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
                btn.backgroundColor = UIColorFromRGB(0xf04100);
            }else{
                [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
                btn.backgroundColor = UIColorFromRGB(0x0070d6);
            }
            
            [self.numberView addSubview:btn];
            [self.btnarray addObject:btn];
        }
        
    }
    

    
    self.viewDate.layer.cornerRadius = 2;
    self.viewDate.layer.masksToBounds = YES;
    self.viewDate.layer.borderColor = UIColorFromRGB(0x999999).CGColor;
    self.viewDate.layer.borderWidth = 0.5;
    
    self.view1.layer.cornerRadius = 2;
    self.view1.layer.masksToBounds = YES;
    self.view1.layer.borderColor = UIColorFromRGB(0x999999).CGColor;
    self.view1.layer.borderWidth = 0.5;
    
    self.view2.layer.cornerRadius = 2;
    self.view2.layer.masksToBounds = YES;
    self.view2.layer.borderColor = UIColorFromRGB(0x999999).CGColor;
    self.view2.layer.borderWidth = 0.5;
    
    self.view3.layer.cornerRadius = 2;
    self.view3.layer.masksToBounds = YES;
    self.view3.layer.borderColor = UIColorFromRGB(0x999999).CGColor;
    self.view3.layer.borderWidth = 0.5;
    
    self.view4.layer.cornerRadius = 2;
    self.view4.layer.masksToBounds = YES;
    self.view4.layer.borderColor = UIColorFromRGB(0x999999).CGColor;
    self.view4.layer.borderWidth = 0.5;
    
}

- (void)setIndex:(int)index{
    _index = index;
    
    NSArray *arrTitles = [NSArray array];
    switch (index) {
        case 0:
            arrTitles = @[@"08",@"22",@"25",@"27",@"30",@"05",@"07"];
            break;
        case 1:
            arrTitles = @[@"02",@"12",@"15",@"26",@"30",@"01",@"03"];
            break;
        case 2:
            arrTitles = @[@"03",@"12",@"15",@"28",@"34",@"02",@"11"];
            break;
        case 3:
            arrTitles = @[@"07",@"11",@"25",@"27",@"29",@"03",@"05"];
            break;
        case 4:
            arrTitles = @[@"08",@"19",@"25",@"27",@"31",@"03",@"04"];
            break;
        case 5:
            arrTitles = @[@"03",@"13",@"25",@"26",@"32",@"06",@"09"];
            break;
        case 6:
            arrTitles = @[@"09",@"10",@"25",@"29",@"32",@"03",@"10"];
            break;
        case 7:
            arrTitles = @[@"03",@"16",@"17",@"23",@"32",@"05",@"09"];
            break;

        default:
            break;
    }
    
    for (int i = 0; i < mArrTop.count; i ++) {
        UIButton *btn = [mArrTop objectAtIndex:i];
        NSString *string = arrTitles[i];
//        [btn setTitle:string forState:UIControlStateNormal];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
